<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<%@include file="../../common/taglib/taglib.jsp" %>
<%@include file="../common/dwz.jsp" %>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="images/favicon.png" type="image/png">
    <title>传感器字典</title>
    <link href="${baseURL}/dwz/css/style.default.css" rel="stylesheet">
    <link href="${baseURL}/dwz/css/jquery.datatables.css" rel="stylesheet">

</head>
<body>
<section>
    <!-- 左侧导航栏开始-->
    <c:import url="../common/left.jsp"></c:import>
    <!-- 左侧导航栏结束-->
    <div class="mainpanel">

        <!-- 头导航栏开始-->
        <c:import url="../common/hander.jsp"></c:import>
        <!-- 头导航栏结束-->

        <div class="contentpanel">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="contentpanel">
                        <div class="form-group">
                            <form action="${baseURL}/bizSensorConfigController/sensor/1" method="get">
                                <h1 class="col-sm-1 control-label" style="padding-top:5px;font-size:20px;">传感器类型:</h1>
                                <div class="col-sm-2">
                                    <!-- 样式1 -->
                                    <select name="type" class="form-control">
                                        <option value="">---请选择---</option>
                                        <option value="应变">应变</option>
                                        <option value="动挠度">动挠度</option>
                                        <option value="振动频率">振动频率</option>
                                        <option value="索力">索力</option>
                                        <option value="静挠度">静挠度</option>
                                        <option value="伸缩缝位移">伸缩缝位移</option>
                                        <option value="温度">温度</option>
                                    </select>
                                </div>
                                <h1 class="col-sm-1 control-label"
                                    style="padding-top:5px;font-size:20px;padding-left: 72px;">桥跨:</h1>
                                <div class="col-sm-2">
                                    <!-- 样式1 -->
                                    <select name="bridgeSpan" class="form-control">
                                        <option value="">---请选择---</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="6">6</option>
                                        <option value="7">7</option>
                                        <option value="8">8</option>
                                        <option value="9">9</option>
                                        <option value="10">10</option>
                                        <option value="11">11</option>
                                        <option value="12">12</option>
                                        <option value="13">13</option>
                                        <option value="14">14</option>
                                    </select>
                                </div>
                                <h1 class="col-sm-1 control-label" style="padding-top:5px;font-size:20px;">传感器位置:</h1>

                                <input id="place" name="sensorPosition" class="col-sm-1" type="text;"
                                       style="padding-top:10px;"/>

                                <div class="col-sm-3" style="padding-top: 5px;">
                                    <button type="submit">查询</button>
                                    <a class="btn btn-info"
                                       href="/bizSensorConfigController/downExcel/">生成Excel</a>

                                </div>
                            </form>
                            <form action="${baseURL}/bizSensorConfigController/upExcel" method="post"
                                  enctype="multipart/form-data">
                                <input value="上传Excel" type="submit">
                                <input type="file" name="file">
                            </form>
                        </div>

                        <div class="row">
                            <!-- 黑色表 -->

                            <div class="col-md-12">
                                <div class="table-responsive">
                                    <table class="table table-dark mb30">
                                        <thead>
                                        <tr>
                                            <th>传感器类型</th>
                                            <th>传感器编号</th>
                                            <th>传感器位置</th>
                                            <th>桥跨</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>

                                        <tbody>

                                        <c:forEach items="${list.content}" var="ab">
                                            <tr>
                                                <td>${ab.type}</td>
                                                <td>${ab.sensorNumber}</td>
                                                <td>${ab.sensorPosition}</td>
                                                <td>${ab.bridgeSpan}</td>
                                                <td>
                                                    <a class="btn btn-success"
                                                       href="/bizSensorConfigController/findById/${ab.id}">修改
                                                    </a>
                                                    <button class="btn btn-danger"
                                                            onclick="deleteById('${ab.id}')">删除
                                                    </button>
                                                </td>
                                            </tr>
                                        </c:forEach>

                                        </tbody>

                                    </table>

                                    <a href="/bizSensorConfigController/sensor/${goods.prePage}">前一页</a>
                                    <a href="/bizSensorConfigController/sensor/1">1</a>
                                    <a href="/bizSensorConfigController/sensor/2">2</a>
                                    <a href="/bizSensorConfigController/sensor/3">3</a>
                                    <a href="/bizSensorConfigController/sensor/4">4</a>
                                    <a href="/bizSensorConfigController/sensor/5">5</a>
                                    <a href="/bizSensorConfigController/sensor/6">6</a>
                                    <a href="/bizSensorConfigController/sensor/${goods.nextPage}">下一页</a>

                                </div><!-- table-responsive -->
                            </div>
                        </div><!-- row -->
                    </div>
                </div><!-- panel-body -->
            </div><!-- panel -->
        </div><!-- contentpanel -->

        <div class="rightpanel">
            <!-- Nav tabs -->
            <ul class="nav nav-tabs nav-justified">
                <li class="active"><a href="#rp-alluser" data-toggle="tab"><i class="fa fa-users"></i></a></li>
                <li><a href="#rp-favorites" data-toggle="tab"><i class="fa fa-heart"></i></a></li>
                <li><a href="#rp-history" data-toggle="tab"><i class="fa fa-clock-o"></i></a></li>
                <li><a href="#rp-settings" data-toggle="tab"><i class="fa fa-gear"></i></a></li>
            </ul>
        </div><!-- rightpanel -->
    </div><!-- mainpanel -->
</section>
</body>

<script>

    function deleteById(id) {
        debugger
        $.ajax({
            type: "get",
            url: "/bizSensorConfigController/delete/" + id,
            data: {"id": id},
            success: function (data) {
                if (data.code == 0) {
                    alert("删除成功")
                    window.location.reload()
                } else {
                    alert("删除失败")
                }
            }
        })
    }

    function updateById(id) {
        debugger
        $.ajax({
            type: "get",
            url: "/bizSensorConfigController/findById/" + id,
            data: {"id": id},
            success: function (data) {
                if (data.code == 0) {
                    alert()
                } else {
                    alert("")
                }
            }
        })
    }

</script>
</html>
